package com.zelin.shop.web;

import com.alibaba.dubbo.config.annotation.Reference;
import com.zelin.entity.TypeTemplateEntity;
import com.zelin.sellergoods.service.TypeTemplateService;
import com.zelin.utils.PageUtils;
import com.zelin.utils.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Arrays;
import java.util.Map;

//import org.apache.shiro.authz.annotation.RequiresPermissions;


/**
 * 
 *
 * @author WF
 * @email 2568783935@qq.com
 * @date 2021-07-23 21:10:35
 */
@RestController
@RequestMapping("/typetemplate")
public class TypeTemplateController {
    @Reference(timeout = 5000)
    private TypeTemplateService typeTemplateService;
    /**
     * 列表
     */
    @RequestMapping("/list")
    //@RequiresPermissions("manager:typetemplate:list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = typeTemplateService.queryPage(params);

        return R.ok().put("page", page);
    }
    /**
     * 信息
     */
    @RequestMapping("/info/{id}")
    public R info(@PathVariable("id") Long id){
		TypeTemplateEntity typeTemplate = typeTemplateService.getById(id);
        return R.ok().put("typeTemplate", typeTemplate);
    }
    /**
     * 保存
     */
    @RequestMapping("/save")
    public R save(@RequestBody TypeTemplateEntity typeTemplate){
		typeTemplateService.save(typeTemplate);
        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    //@RequiresPermissions("manager:typetemplate:update")
    public R update(@RequestBody TypeTemplateEntity typeTemplate){
		typeTemplateService.updateById(typeTemplate);
        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    //@RequiresPermissions("manager:typetemplate:delete")
    public R delete(@RequestBody Long[] ids){
		typeTemplateService.removeByIds(Arrays.asList(ids));
        return R.ok();
    }

}
